/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package client.domainModels.NodeImpl;

import java.util.ArrayList;
import java.util.Arrays;

/**
 * 
 * @author Wei WANG
 */
public class Performatif extends AbstractNode {

	private static ArrayList<String> history = new ArrayList<String>();
	private String[] historySet = { "accept-proposal", "agree", "cancel",
			"cfp", "confirm", "disconfirm", "execute", "failure", "inform",
			"inform-if", "inform-vef", "not-understood", "propagate",
			"propose", "proxy", "query-if", "query-vef", "refuse",
			"reject-proposal", "request", "request-when", "request-whenever",
			"subscribe" };

	public Performatif() {
		super();
		getHistoryList().addAll(Arrays.asList(historySet));
	}

	@Override
	public String[] getChildNodeNames() {
		String[] strings = {};
		return strings;
	}

	public String[] getNodeAttributes() {
		// TODO Auto-generated method stub
		String[] attributes = { "name" };
		return attributes;
	}

	public String toString() {
		return "Performatif: " + getID();
	}

	@Override
	public String getStringRepresentation() {
		// TODO Auto-generated method stub
		return "      <performatif name='" + this.getID() + "'/>\n";
	}
	
	public void addRecordInHistory(String s){
		if(history.indexOf(s)==-1){
			history.add(s);
		}
	}
	
	public ArrayList<String> getHistoryList(){
		return history;
	}
	
	public String[] getHistorySet(){
		return (String[]) history.toArray();
	}

	@Override
	public String getRep() {
		// TODO Auto-generated method stub
		return getID();
	}
}
